/**
 * @Title: FinishSampleCountModal.js
 * @Description: FinishSampleCountModal
 * @author: Fanchao
 * @date: 2020/9/2 9:41 上午
 * @version V1.0
 */
import React from "react";
import { Modal, Select, Table } from "antd";

const { Option } = Select;

const FinishSampleCountModal = ({ finishSampleCountModalVisible, finishSampleCountList, finishStatus, evaluateTaskId, cb, dispatch }) => {
    const columns = [
        {
            title: "姓名",
            dataIndex: "realName",
            align: "left",
            ellipsis: true
        },
        {
            title: "证件号",
            dataIndex: "credentialsNo",
            align: "left",
            ellipsis: true
        },
        {
            title: "所在单位",
            dataIndex: "department",
            align: "left",
            ellipsis: true
        },
        {
            title: "完成状态",
            dataIndex: "finishStatus",
            align: "left",
            ellipsis: true
        },
        {
            title: "评分",
            dataIndex: "score",
            align: "left",
            ellipsis: true
        }

    ];
    return (
        <Modal
            title="评价情况"
            width='900px'
            visible={finishSampleCountModalVisible}
            onOk={() => {
                cb && cb(false);
            }}
            onCancel={() => {
                cb && cb(false);
            }}
        >
            <div>
                <div style={{ marginBottom: "10px" }}>
                    <label style={{ marginRight: "6px" }}>完成状态:</label>
                    <Select
                        value={finishStatus}
                        style={{ width: 200 }}
                        onChange={(value) => {
                            dispatch({
                                type: "task/setFinishStatus",
                                payload: value
                            });

                            dispatch({
                                type: "task/getTaskUserInfoTableList",
                                payload: {
                                    finishStatus: value,
                                    evaluateTaskId
                                }
                            });
                        }}
                    >
                        <Option value="全部">全部</Option>
                        <Option value="已完成">已完成</Option>
                        <Option value="待完成">待完成</Option>
                    </Select>
                </div>
                <Table
                    columns={columns}
                    dataSource={finishSampleCountList}
                    size="middle"
                    pagination={false}
                    rowKey='credentialsNo' // 唯一key值
                />
            </div>
        </Modal>
    );
};

export default FinishSampleCountModal;

